package com.gregbugaj.gps;

import java.util.Date;

public class RoutePoint {

	private Latitude latitude;
	private Longitude longitude;
	private Date time;
	private double speedInKM;

	public Latitude getLatitude() {
		return latitude;
	}
	public void setLatitude(Latitude latitude) {
		this.latitude = latitude;
	}
	public Longitude getLongitude() {
		return longitude;
	}
	public void setLongitude(Longitude longitude) {
		this.longitude = longitude;
	}
	public Date getTime() {
		return time;
	}
	public void setTime(Date time) {
		this.time = time;
	}
	public double getSpeedInKM() {
		return speedInKM;
	}
	public void setSpeedInKM(double speedInKM) {
		this.speedInKM = speedInKM;
	}

	public boolean equals(RoutePoint that) {	
		if(this==that)return true;
		
		if(!this.latitude.equals(that.latitude) || !this.longitude.equals(that.longitude)  ){			
			return false;
		}
		if( !(this.speedInKM == that.speedInKM)){			
			return false;
		}
		return true;
	}
	
	@Override
	public String toString() {
		return "["+latitude+","+longitude+", speed="+speedInKM+ ", time="+time+"]";
	}
	/**
	 * Check if the given point is valide
	 * @return true if valid point otherwise false
	 */
	public boolean validate() {		
		if(this.latitude.getDecimal()==0.0){
			return false;
		}
		
		return true;
	}
}
